/**************************************************************************
 * @doc ICIC
 * @module ICIC ICICISO.H |
 * Source code for the ICIC handling functions.
 * Product         :   SoftPay 2000 (Global Payment Methodology).
 * <nl>Developer   :   SoftPay Development Team (I_SP2000).
 * <nl>Notes       :
 * @head3 ICIC Printer related Functions |
 * @index | ICIC
 * @end
 *
 * Copyright (c) 1996-2000 by VeriFone Inc. All rights reserved.
 *
 * No part of this software may be used, stored, compiled, reproduced,
 * modified, transcribed, translated, transmitted, or transferred, in any form
 * or by any means whether electronic, mechanical, magnetic, optical,
 * or otherwise, without the express prior written permission of VeriFone, Inc.
 *
 * Revision History
 * ------------------------------------------------------------------------
 $Log:

********************************************************************************/
#include <packet.h>

//#define CHIP_POS_DEBIT_ENTRY_CODE		"051"
#define CHIP_POS_ENTRY_CODE			"051"      //Terminal is capable of acceptig PIN entry
#define CHIP_SWIPE_POS_DEBIT_ENTRY_CODE 		"801"
#define CHIP_SWIPE_POS_ENTRY_CODE 		"802"
#define CHIP_MANUAL_POS_DEBIT_ENTRY_CODE "791"
#define CHIP_MANUAL_POS_ENTRY_CODE "792"

//edi - AMEX EMV///////////////////////////////////////////////////////
#define CHIP_MANUAL_AMEX_POS_ENTRY_CODE "512"
#define CHIP_SWIPE_AMEX_POS_ENTRY_CODE 		"522"

#define CHIP_SWIPE_AMEX4DBC_POS_ENTRY_CODE 		"561"
#define CHIP_MANUAL_AMEX4DBC_POS_ENTRY_CODE "571"

#define CHIPFALLBACK_SWIPE_AMEX4DBC_POS_ENTRY_CODE "661"
#define CHIPFALLBACK_MANUAL_AMEX4DBC_POS_ENTRY_CODE "671"
#define CHIPFALLBACK_MANUAL_AMEX_POS_ENTRY_CODE "611"
#define CHIPFALLBACK_SWIPE_AMEX_POS_ENTRY_CODE "621"
#define CHIP_AMEX_POS_ENTRY_CODE 		"551"
#define AMEX_SWIPE_POS_ENTRY_CODE  "521"
//////////////////////////////////////////////////////////////


#define IMAM_MSD_TAP_CARD_ENTRY_MODE   "911"   //PAYPASS MSD
#define IMAM_CHIP_TAP_CARD_ENTRY_MODE  "071"   //VISAWAVE CHP

#define EMV_FIELD55_SIZE   255
#define EMV_FIELD23_SIZE   4   // jrd 05212005

extern void vdLoadEMVField22(TRANSACTION_OBJECT *pobTran);
extern void vdLoadEMVField55(TRANSACTION_OBJECT *pobTran);
extern int inCITIBuildEMV_AMEXHostData(TRANSACTION_OBJECT *pobTran,unsigned char *pbtBuff, unsigned short *pusLen);
extern int inAddDataToEMV_AMEXPacket(unsigned short usTag, unsigned char *pbtPackBuff); //edi - AMEX EMV
extern int inAddDataToEMV_AMEXPacket2(unsigned short usTag, unsigned char *pbtPackBuff); //edi - AMEX EMV

extern int inCITIBuildEMVHostData(TRANSACTION_OBJECT *pobTran,unsigned char *pbtBuff, unsigned short *pusLen);
extern int inAddDataToEMVPacket(unsigned short usTag, unsigned char *pbtPackBuff);
extern int inEMVPIPAnalyse  (PACKET_OBJECT *pobPacket);
extern int inLoadBitmap (unsigned short shTransCode, unsigned char *btMti, unsigned char *btMap8583, unsigned char *btProcCode);
extern void vdCPACSyncHostDateTime(char *hostdate, char *hosttime);
extern int inUploadCPACAdvices (VS_BOOL fSettle, TRANSACTION_OBJECT *pobTran);
int inGetDataFromBatchToEMVPacket(TRANSACTION_OBJECT *pobTran, unsigned int uiFieldID,  int inSize, unsigned char *pbtBuff);
extern int inMakeEMVBatchData(unsigned short usTag, unsigned char *pbtPackBuff);
extern int inMakeAmexEMVBatchData1(unsigned short usTag, unsigned char *pbtPackBuff) ;//edi - AMEX EMV
extern int inMakeAmexEMVBatchData2(unsigned short usTag, unsigned char *pbtPackBuff);
extern void hex_2_asc(BYTE *outp, BYTE *inp, int length);
extern void vdLoadCPACField22(TRANSACTION_OBJECT* pobTran) ;
extern int inGetDataLengthFromBatch(TRANSACTION_OBJECT *pobTran, unsigned int uiFieldID);
extern void vdEMVLoadField38 (TRANSACTION_OBJECT *pobTran);
int inBuildTLVfromData(unsigned char *pbtPackBuff, unsigned short usTag, unsigned short usTagLen, unsigned char *chBuffer);
extern void vdImamGetCTLData (BATCH_REC *psrBRec, unsigned char * pszData);

